import { t } from 'i18next'
import { MtEntity } from '@/api/manager/mt'
import { TerMode } from './translator'
export class RollTerMode {
	/**终端对象*/
	mcc: MtEntity
	/**终端的mtKey */
	mtKey: string
	/**点名状态 */
	callState?: 0 | 1
	status: {
		checked: boolean
		pass: boolean | null
		remarkTrue?: boolean
		isOnline: boolean
	}
	constructor(mt: MtEntity) {
		this.mcc = mt
		this.mtKey = mt.mt_key
		this.callState = 0
		this.status = {
			checked: false,
			pass: false,
			remarkTrue: false,
			isOnline: !!mt.online,
		}
	}
}
/**搜索回调的参数实体 */
export interface searchSuccessCallParamsEntity {
	/**被点名人列表-不通过*/
	roll_callee_no_pass: Array<MtEntity>
	/**被点名人列表-通过*/
	roll_callee_pass: Array<MtEntity>
	/**被点名人列表 */
	roll_callee: Array<MtEntity>
}
/**点名人=>下拉选项 */
export type callerOptionsEntity = {
	mtKey: string
	name: string
}
export type PlanEntity = Array<{
	label: string
	value: string
}>
/**页面参数*/
export interface PageEntity {
	/**当前被点名人 */
	curRollCallee: MtEntity | null
	/**模式列表 */
	modeOptions: PlanEntity
	/**模式选择值 */
	modeValue: string
	/**点名人下拉列表 */
	callerOptions: Array<callerOptionsEntity>
	/**选中点名人mtKey值*/
	callerValue: string
	/**清空按钮状态 */
	disabledClear: boolean
	/**预案列表 */
	planOptions: PlanEntity
	/**预案选中的值 */
	planValue: string
	/**被点名人列表 */
	calleeList: Array<RollTerMode>
	/**轮询状态0 空闲  1轮询中 */
	state: number
	/**显示的轮询终端 */
	list: Array<TerMode>
	/**轮询终端*/
	members: Array<RollTerMode>
	/**轮询终端数据备份*/
	membersDataBackup: Array<MtEntity>
	/**保存预案的模态框 */
	isSavePlanOpen: boolean
	/**输入的预案名称 */
	name: string
	/**消息推送使用的数据 */
	previewData: any
	/**是否处于编辑状态*/
	isEdit: boolean
	radioFlag: boolean
	/**1为正在切换预案 */
	change_plan: 0 | 1
	// 展示眼睛
	openShow: boolean
	disabledUp: boolean
	disabledDown: boolean
	_start: string
	_changes: string[]
	/**当前点名人*/
	cur_roll_caller: MtEntity | null
	/**上一次的点名人(切换点名人列表产生) */
	pre_roll_caller: MtEntity | null
	/**当前被点名人*/
	cur_roll_callee: MtEntity | null
	/**点名模式1-vmp;2-点名人(默认值);3-被点名人 */
	mode: 1 | 2 | 3
	/**点名签到表按钮接口返回*/
	roll_call_sign_enable: 0 | 1
	/**点名签到表的状态*/
	roll_call_sign_enable_disabled: boolean
	/**被点名人列表 */
	roll_callee: Array<MtEntity>
	/**被点名人列表-通过 */
	roll_callee_pass: Array<MtEntity>
	/**被点名人列表-未被点名 */
	roll_callee_no_call: Array<MtEntity>
	/**被点名人列表-未通过 */
	roll_callee_no_pass: Array<MtEntity>
	/**历史点名人*/
	roll_caller: Array<MtEntity>
	/**预案名称*/
	preName: string
	/**是否在搜索中*/
	isSearch: boolean
	/**搜索缓存终端*/
	searchCacheMt: Array<MtEntity>
	/**搜索被点名人输入值 */
	inputKeyUp: string
	disabledCallPre: boolean
	disabledCallNext: boolean
	disabledModeSelect: boolean
	disabledPlanSelect: boolean
	/**是否处于被邀请终端 */
	addMtFlag: boolean
	/**添加终端时获取被选看列表Account信息 */
	rollcalleeAccount: Array<MtEntity>
	thisMts: Array<MtEntity>
}
/**初始化state值 */
export let initData: PageEntity = {
	thisMts: [],
	rollcalleeAccount: [],
	disabledModeSelect: false,
	disabledPlanSelect: false,
	pre_roll_caller: null,
	addMtFlag: false,
	modeOptions: [
		{
			value: '2',
			label: t('点名人模式'),
		},
		{
			value: '3',
			label: t('被点名人模式'),
		},
		{
			value: '1',
			label: t('画面合成模式（左右）'),
		},
		{
			value: '4',
			label: t('画面合成模式（一大一小）'),
		},
	],
	modeValue: '2',
	callerOptions: [{ name: t('请选择点名人'), mtKey: '-1' }],
	callerValue: '-1',
	preName: '',
	mode: 1,
	state: 0,
	roll_caller: [],
	roll_callee: [],
	cur_roll_caller: null,
	cur_roll_callee: null,
	roll_callee_pass: [],
	roll_callee_no_call: [],
	roll_callee_no_pass: [],
	roll_call_sign_enable: 0,
	roll_call_sign_enable_disabled: false,
	openShow: false,
	inputKeyUp: '',
	disabledClear: false,
	disabledUp: true,
	disabledDown: true,
	change_plan: 0,
	planOptions: [{ label: t('不使用预案'), value: '0' }],
	curRollCallee: null,
	isEdit: false,
	planValue: '',
	membersDataBackup: [],
	list: [],
	members: [],
	isSavePlanOpen: false,
	radioFlag: false,
	name: '',
	previewData: {},
	calleeList: [],
	_start: '',
	_changes: [],
	isSearch: false,
	disabledCallPre: false,
	disabledCallNext: false,
	searchCacheMt: [],
}
